import * as React from 'react';
import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom';

import { Home, SubTool, BaseType, Counter, DeclareInfo, InterfaceInfo, OtherInterface, Classes,
Functions, Genericity, Keyof } from '../pages';

class App extends React.Component {
    public render(){
        return (
            <Router>
                <Switch >
                    {/* home */}
                    <Route exact={true} path="/home" component={Home} />
                    {/* subtool */}
                    <Route exact={true} path="/subtool" component={SubTool} />
                    {/* 基础类型 */}
                    <Route exact={true} path="/baseType" component={BaseType} />
                    {/* effect */}
                    <Route exact={true} path="/effect" component={Counter} />
                    {/* 变量定义 */}
                    <Route exact={true} path="/declareInfo" component={DeclareInfo} />
                    {/* 接口 */}
                    <Route exact={true} path="/interfaceInfo" component={InterfaceInfo} />
                    <Route exact={true} path="/otherInterface" component={OtherInterface} />
                    {/* 函数 */}
                    <Route exact={true} path="/functions" component={Functions} />
                    {/* 泛型 */}
                    <Route exact={true} path="/genericity" component={Genericity} />
                    {/* keyof */}
                    <Route exact={true} path="/keyof" component={Keyof} />
                    {/* 类 */}
                    <Route exact={true} path="/classes" component={Classes} />
                    <Redirect push={false} exact={false} strict={false} from="/" to={{
                        pathname: "/baseType",
                        search: "?utm=your+face",
                        state: { referrer: 'kkcsal' }
                    }}/>

                </Switch>
            </Router>
        );
    }
}

export default App;
